//类模板
function ParseTemplate(obj, staticobj, template) {
    if (template.extend) {
        ParseTemplate(obj, staticobj, template.extend);
    }
    let ctor = null;
    for (let key in template) {
        if (key=="extend") {
            continue;
        }
        else if (key=="ctor") {
            ctor = template[key];
        }
        else if (key=="static") {
            for (let sk in template[key]) {
                staticobj[sk] = template[key][sk];
            }
        }
        else {
            obj[key] = template[key];
        }
    }
    if (ctor) {
        ctor.call(obj);
    }
}

function MakeClass(template){
    let ostatic = {};
    ParseTemplate(this, ostatic, template);
    MakeClass.prototype.static = ostatic;
}

module.exports = MakeClass;